package com.ruoyi.module.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.module.mapper.MaterialCategoryMapper;
import com.ruoyi.module.domain.MaterialCategory;
import com.ruoyi.module.service.IMaterialCategoryService;

/**
 * 素材库类目Service业务层处理
 * 
 * @author fubojin
 * @date 2025-03-01
 */
@Service
public class MaterialCategoryServiceImpl implements IMaterialCategoryService 
{
    @Autowired
    private MaterialCategoryMapper materialCategoryMapper;

    /**
     * 查询素材库类目
     * 
     * @param id 素材库类目主键
     * @return 素材库类目
     */
    @Override
    public MaterialCategory selectMaterialCategoryById(Long id)
    {
        return materialCategoryMapper.selectMaterialCategoryById(id);
    }

    /**
     * 查询素材库类目列表
     * 
     * @param materialCategory 素材库类目
     * @return 素材库类目
     */
    @Override
    public List<MaterialCategory> selectMaterialCategoryList(MaterialCategory materialCategory)
    {
        return materialCategoryMapper.selectMaterialCategoryList(materialCategory);
    }

    /**
     * 新增素材库类目
     * 
     * @param materialCategory 素材库类目
     * @return 结果
     */
    @Override
    public int insertMaterialCategory(MaterialCategory materialCategory)
    {
        materialCategory.setCreateTime(DateUtils.getNowDate());
        return materialCategoryMapper.insertMaterialCategory(materialCategory);
    }

    /**
     * 修改素材库类目
     * 
     * @param materialCategory 素材库类目
     * @return 结果
     */
    @Override
    public int updateMaterialCategory(MaterialCategory materialCategory)
    {
        materialCategory.setUpdateTime(DateUtils.getNowDate());
        return materialCategoryMapper.updateMaterialCategory(materialCategory);
    }

    /**
     * 批量删除素材库类目
     * 
     * @param ids 需要删除的素材库类目主键
     * @return 结果
     */
    @Override
    public int deleteMaterialCategoryByIds(Long[] ids)
    {
        return materialCategoryMapper.deleteMaterialCategoryByIds(ids);
    }

    /**
     * 删除素材库类目信息
     * 
     * @param id 素材库类目主键
     * @return 结果
     */
    @Override
    public int deleteMaterialCategoryById(Long id)
    {
        return materialCategoryMapper.deleteMaterialCategoryById(id);
    }
}
